//
//  BQNavBarView.m
//  Adorable_Things
//
//  Created by ybq on 16/1/13.
//  Copyright © 2016年 Banana Inc. All rights reserved.
//

#import "BQNavBarView.h"

@implementation BQNavBarView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
        _avatarImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 14, 20, 18)];
        _avatarImageView.image = [UIImage imageNamed:@"iconfont-sandian"];
        [self addSubview:_avatarImageView];
        
        _avatarButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _avatarButton.frame = CGRectMake(15, 10, 25, 25);
        _avatarButton.layer.cornerRadius = 12.5;
        _avatarButton.layer.masksToBounds = YES;
        [_avatarButton setImage:[UIImage imageNamed:@"avatar-no"] forState:(UIControlStateNormal)];
        [self addSubview:_avatarButton];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kWidth / 2 - 30, 10, 60, 25)];
        _titleLabel.font = [UIFont systemFontOfSize:20];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.text = @"萌货";
        [self addSubview:_titleLabel];
        
        _searchButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _searchButton.frame = CGRectMake(kWidth - 40, 10, 25, 25);
        [_searchButton setImage:[UIImage imageNamed:@"iconfont-sousuo"] forState:(UIControlStateNormal)];
        [self addSubview:_searchButton];
        
        UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(0, frame.size.height - .5, kWidth, .5)];
        line.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:line];
    }
    return self;
}


@end
